package com.gzjh.basic.common;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

import org.hibernate.criterion.DetachedCriteria;

public interface IBaseDao<T, PK extends Serializable> {
	
	public Serializable save(T t);
	
	public void update(T t);

	public void delete(T t);
	
	public void deleteAll (Collection<?> entities);
	
	public T get(Class<T> entityClass, PK pk);
	
	public List<T> getAll(Class<T> entityClass);
	
	public T load(Class<T> entityClass, PK pk);
	
	public List<T> loadAll(Class<T> entityClass);
	
	public void saveOrUpdate(T t);
	
	public List<?> findByCriteria(DetachedCriteria criteria);
	
	public List<?> findByCriteria(DetachedCriteria criteria, int firstResult, int maxResults);

	public List<T> createNativeQuery(String sqlString, Class<T> resultClass);
	
	public List<T> createNativeQuery(String sqlString, Class<T> resultClass, int firstResult, int maxResult);
	
	public List<T> createNativeQuery(String sqlString, Object[] params, Class<T> resultClass, int firstResult, int maxResult);
	
	public List<?> createNativeQuery(String sqlString);
	
	public List<?> createNativeQuery(String sqlString, Object[] params);
	
	public List<T> findByHql(String hqlString, Object[] params, Class<T> resultClass);
	
	public List<?> findByHql(String hqlString, Object[] params);
	
	public List<T> findByHql(String hqlString, Object[] params, Class<T> resultClass, int firstResult, int maxResult);
	
	public List<?> findByHql(String hqlString, Object[] params, int firstResult, int maxResult);
	
}
	